import time

def showTime(func):
    """
    装饰器：计算函数运行时间
    :param func:
    :return:
    """
    def wrapper(*args, **kwargs):
        start = time.perf_counter()
        func(*args, **kwargs)
        end = time.perf_counter()
        print(f"函数{func.__name__}，运行时间：{end - start} s")
    return wrapper

@showTime
def test():
    print("装饰器.......")
    time.sleep(5)

if __name__ == "__main__":
    test()